const { DataTypes } = require('sequelize')
const sequelize = require('./db')
const Condition = sequelize.define(
  'condition',
  {
    // 理解为表中的列
    // 会自动添加一个叫做Id的主键
    userName: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    coordinateX: {
      type: DataTypes.FLOAT(11),
      allowNull: false,
    },
    coordinateY: {
      type: DataTypes.FLOAT(11),
      allowNull: false,
    },
    type: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    position: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    sign: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    date: {
      type: DataTypes.DATE,
      allowNull: false,
    },
    describe: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    pass: {
      type: DataTypes.BOOLEAN,
      allowNull: false,
      defaultValue: false, //默认登录状态为false
    },
  },
  {
    paranoid: true, // 默认是false
  }
)
module.exports = Condition
